import React from 'react';
import { connect } from 'dva';
import Modal from '../../components/Sideslip/Sideslip';
import Form from './indexForm';
import HistoryForm from './historyForm';


class PersonalModal extends React.Component{
    closeModal = () => {
        this.props.operateModal();
    }
    queryHistory = (val) => {
        this.props.query(val);
    }
    render() {
        const flag = this.props.optionType;
        return (
            <Modal visable={this.props.visable} closeModal={this.closeModal} getServicePeople={this.props.getServicePeople} >
                {
                    flag === 'history' ? 
                    <HistoryForm historyList={this.props.historyList} queryHistory={this.queryHistory} id={this.props.data}/> :
                    <Form closeModal={this.closeModal} data={this.props.data} getServicePeople={this.props.getServicePeople} optionType={this.props.optionType}/>
                }
            </Modal>
        );
    }
}

export default connect()(PersonalModal);